package cn.net.xyan.easy.webapp.base.support;

import cn.net.xyan.easy.webapp.base.entity.SystemUser;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * Created by xiashenpin on 16/1/24.
 */
public class SecurityUserDetails  extends org.springframework.security.core.userdetails.User {
    private SystemUser user;

    public SecurityUserDetails(SystemUser user, Collection<? extends GrantedAuthority> authorities) {
        super(user.getUsername(), user.getPassword(), authorities);
        this.user = user;
    }

    public SecurityUserDetails(SystemUser user, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(user.getUsername(), user.getPassword(), enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.user = user;
    }

    public SystemUser getUser() {
        return user;
    }
}
